'''
Created on Feb 3, 2014

@author: James
'''

import hmac

#
# Cookie Handling
#
SECRET = 'ThisIsSuperSecret'

def hash_str(s):
    return hmac.new(SECRET, s).hexdigest()

def make_secure_val(s):
    return "%s|%s" % (s, hash_str(s))

def check_secure_val(h):
    if(h):
        val = h.split('|')[0]
        if h == make_secure_val(val):
            return val
